function MyEffect() {
};

MyEffect.slide = function(container, loadingDiv, callbackFunc) {
  container.style.position = 'absolute';
  
  if (!loadingDiv) {
    loadingDiv = document.createElement('div');
    loadingDiv.style.position = 'absolute';
    loadingDiv.style.left = container.offsetLeft + container.offsetWidth + 'px';
    loadingDiv.style.top = container.offsetTop + 'px';
    loadingDiv.style.width = container.offsetWidth + 'px';
    loadingDiv.style.height = container.offsetHeight + 'px';
    loadingDiv.style.textAlign = 'center';
    loadingDiv.style.verticalAlign = 'middle';
    loadingDiv.style.paddingTop = '100px';
    
    var img =  document.createElement('img');
    img.src = 'image/loading.gif';
    loadingDiv.appendChild(img);
    loadingDiv.appendChild(document.createTextNode('Loading...'));
    container.parentNode.appendChild(loadingDiv);
  }
  
  if ((container.offsetWidth + container.offsetLeft) < 0) {
    callbackFunc();
    return;
  }
  
  container.style.left = container.offsetLeft - 10 + 'px';
  loadingDiv.style.left = container.offsetLeft + container.offsetWidth + 'px';
  setTimeout(function() { MyEffect.slide(container, loadingDiv, callbackFunc); }, 1);
};

MyEffect.slideToRight = function(container, loadingDiv, callbackFunc) {
  container.style.position = 'absolute';
  
  if (!loadingDiv) {
    loadingDiv = document.createElement('div');
    loadingDiv.style.position = 'absolute';
    loadingDiv.style.left = container.offsetLeft - container.offsetWidth + 'px';
    loadingDiv.style.top = container.offsetTop + 'px';
    loadingDiv.style.width = container.offsetWidth + 'px';
    loadingDiv.style.height = container.offsetHeight + 'px';
    loadingDiv.style.textAlign = 'center';
    loadingDiv.style.verticalAlign = 'middle';
    loadingDiv.style.paddingTop = '100px';
    
    var img =  document.createElement('img');
    img.src = 'image/loading.gif';
    loadingDiv.appendChild(img);
    loadingDiv.appendChild(document.createTextNode('Loading...'));
    container.parentNode.appendChild(loadingDiv);
  }
  
  if (container.offsetWidth < container.offsetLeft) {
    callbackFunc();
    return;
  }
  
  container.style.left = container.offsetLeft + 10 + 'px';
  loadingDiv.style.left = container.offsetLeft - container.offsetWidth + 'px';
  setTimeout(function() { MyEffect.slideToRight(container, loadingDiv, callbackFunc); }, 1);
};
